import java.util.Arrays;

class Solution {
    public static void main(String[] args) {
        int []array = {2,7,11,15};
        int []array1 = {3,2,4};
        System.out.println(Arrays.toString(twoSum(array, 9)));
        System.out.println(Arrays.toString(twoSum(array1, 6)));
    }

    public boolean isSameTree(TreeNode leftTree, TreeNode rightTree) {
        if (leftTree == null && rightTree != null || rightTree == null && leftTree != null) {
            return false;
        }


        if (rightTree == null && leftTree == null) {
            return true;
        }


        if (leftTree.val != rightTree.val) {
            return false;
        }

        return isSameTree(leftTree.left, rightTree.right) && isSameTree(rightTree.left, leftTree.right);
    }

    public boolean isSymmetric(TreeNode root) {
        if (root == null) {
            return true;
        }
        return isSameTree(root.left, root.right); //比较值
    }

    public static int[] twoSum(int[] nums, int target) {
        for (int i = 0; i < nums.length - 1; i++) {   //循环
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] + nums[j] == target) {
                    return new int[]{i, j};
                }
            }
        }
        return new int[]{};
    }
}